package contato.DAO;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class HibernateFactory {

	private static EntityManagerFactory _entityManagerFactory = null;

	public static EntityManager getEntityManager() {
		if (_entityManagerFactory == null) {
			_entityManagerFactory = Persistence
					.createEntityManagerFactory("maindatabase");
		}

		return _entityManagerFactory.createEntityManager();
	}
}
